<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //window.document.querySelector()
        var num = 10; //全局变量
        console.log(num); //10
        console.log(window.num); //10  全部变量会自动变成window的属性

        function fn() {
            console.log(11);
        }
        fn(); //11
        window.fn(); //11  字面量创建对象,调用方法

        alert(11);
        window.alert(11);
        console.dir(window); //查看window里面所有
        /* var name = 1; */
        console.log(window.name);
    </script>

</body>

</html>